package com.frame.exception

import org.slf4j.Logger
import org.slf4j.LoggerFactory

import javax.ws.rs.core.Response
import javax.ws.rs.ext.ExceptionMapper
import javax.ws.rs.ext.Provider

/**
 * 异常映射
 *
 * Created by three on 14-7-30.
 */
@Provider
class ClassNotFoundMapper implements ExceptionMapper<ClassNotFoundException> {

    private Logger log = LoggerFactory.getLogger(ClassNotFoundMapper.class);

    @Override
    Response toResponse(ClassNotFoundException exception) {
        return Response.status(Response.Status.INTERNAL_SERVER_ERROR).
            entity(exception.getMessage()).
            type("text/plain").
            build();
    }
}
